<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- 当有多个插槽在决定插槽的内容时,需要具体指定更改的是哪一个插槽-->
        <cpn>
            <button slot="center">按钮</button>
        </cpn>
    </div>

    <template id="cpn">
        <div>
            <!-- 定义三个插槽,当定义多个插槽时,需要添加name属性加以区分,即具名插槽-->
            <slot name="left">
                <span>左边</span>
            </slot>
            <slot name="center">
                <span>中间</span>
            </slot>
            <slot name="right">
                <span>右边</span>
            </slot>
        </div>
    </template>

    <script src="../js/vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                message: '苏州大学'
            },
            components: {
                cpn: {
                    template: '#cpn'
                }
            }
        })
    </script>
</body>
</html>